#! /bin/sh
#
# This file generates the symbol table for the kvm subsystem. The
# table is limited to the ones we believe are needed.

symbols=""
while read sym
do
  symbols="${symbols} ${sym}"
done <<EOF
_ahstat
_arpstat
_carpstats
_clust_hiwm
_clust_lowm
_ddpcb
_ddpstat
_divcbinfo
_espstat
_icmp6stat
_icmpstat
_ifnet
_igmpstat
_ip6stat
_ipcompstat
_ipsec4stat
_ipsec6stat
_ipstat
_ipxpcb_list
_ipxstat
_mbstat
_mb_statpcpu
_mbtypes
_mbuf_hiwm
_mbuf_lowm
_mf6ctable
_mfchashtbl
_mfctablesize
_mif6table
_mrt6stat
_mrtstat
_netisr_bindthreads
_netisr_defaultqlimit
_netisr_dispatch_policy
_netisr_maxprot
_netisr_maxqlimit
_netisr_maxthreads
_netisr_proto
_ngsocklist
_nmbclusters
_nmbufs
_nws
_nws_array
_nws_count
_pagesize
_pfkeystat
_pfsyncstats
_pim6stat
_pimstat
_rip6stat
_ripcbinfo
_rtree
_rtstat
_rt_tables
_rttrash
_sctpstat
_sfstat
_smp_cpus
_spx_istat
_tcbinfo
_tcps_states
_tcpstat
_udbinfo
_udpstat
_unp_count
_unp_dhead
_unp_gencnt
_unp_shead
_unp_sphead
_viftable
EOF

cat <<EOF
/**** THIS FILE IS GENERATED BY A SCRIPT ****/

/*
 * This file contains the known list of symbols for the kvm subsystem.
 */

#include <machine/rtems-bsd-kernel-space.h>

#include "kvm_private.h"

/*
 *  The following is the known list of symbols that may be passed
 *  to the kvm family of calls.
 */

EOF
for sym in ${symbols}
do
  echo "extern int _bsd${sym} __attribute((weak));"
done

cat <<EOF
/*
 *  The following is the known list of symbols that may be passed
 *  to the kvm family of calls.
 */

const kvm_symval_t rtems_kvm_symbols[] = {
EOF
for sym in ${symbols}
do
  echo "  { \"${sym}\", (uintptr_t) &_bsd${sym} },"
done

cat <<EOF
  { "", 0 }
};
EOF
